<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/templates/template.xhtml">
    <ui:define name="content">
    <h:form id="findForm" align="center">
			<br />
           
		<div id="block" align="center" style="width : 800px; font-size:11pt" >
		<p:panel id="panel">
            <f:facet name="header" >
			<h3><h:outputText value="Find User" /></h3>
            </f:facet>
            <br />
        	<h:outputText style="font-size: 12pt" value="Please enter search criteria, if non is entered search will return all users" /><br/><br/>
    	
        		<h:panelGrid columns="5" style="margin-right:10px; cellspacing : 10pt">
        			
        			<h:outputText value="User Id: "  />
        			<p:inputText value="#{userBean.userId}" required="false"  styleClass="tb5" style="width: 50px;" />
        			<p:spacer width="30" />
        			<h:outputText value="First Name: "  />
        			<p:inputText value="#{userBean.user.firstName}"  styleClass="tb5" />
        			
        			
        			<h:outputText value="Last Name: "  />
        			<p:inputText value="#{userBean.user.lastName}"  styleClass="tb5"/>
        			<p:spacer width="30" />
        			
        			<h:outputText value="Job: "  />
        			
        			<h:selectOneMenu  value="#{userBean.user.jobId}"   >
        				<f:selectItem itemLabel="" itemValue="" />
        				<f:selectItems value="#{userBean.jobs}"/>
        			</h:selectOneMenu>
        			
        			
        			<h:outputText value="Email Address: "  />
        		<p:inputText value="#{userBean.user.userEmail}"  styleClass="tb5" />
        			<p:spacer width="30" />
        			<h:outputText value="Provider: "  />
        			
        			<h:selectOneMenu  value="#{userBean.user.providerId}"   >
        				<f:selectItem itemLabel="" itemValue="" />
        				<f:selectItems value="#{userBean.providers}"/>
        			</h:selectOneMenu>
        			
        			
        			<h:outputText value="User Category: "  />
        			
        			<h:selectOneMenu  value="#{userBean.user.userType}"   >
        				<f:selectItem itemLabel="" itemValue="" />
        				<f:selectItem itemLabel="Internal" itemValue="Internal"/>
        				<f:selectItem  itemLabel="External" itemValue="External"/>
        			</h:selectOneMenu>
        			<p:spacer width="30" />
        			
        			<h:outputText value="Address: "  />
        			
        			<p:inputText value="#{userBean.user.userAddress}"  styleClass="tb5"/>
        		
        			
        			<h:outputText value="City: "  />
        			
        			<p:inputText value="#{userBean.user.userCity}"  styleClass="tb5"/>
        		
        			<p:spacer width="30" />
        			<h:outputText value="State: "  />
        			
        			<h:selectOneMenu  value="#{userBean.user.userState}"   >
        				<f:selectItem itemLabel="" itemValue="" />
        				<f:selectItem itemLabel="ALABAMA	 " itemValue="AL" />
						<f:selectItem itemLabel="ALASKA	 " itemValue="AK" />
						<f:selectItem itemLabel="AMERICAN SAMOA	 " itemValue="AS" />
						<f:selectItem itemLabel="ARIZONA	 " itemValue="AZ" />
<f:selectItem itemLabel="ARKANSAS" itemValue="AR" />
<f:selectItem itemLabel="CALIFORNIA" itemValue="CA" />
<f:selectItem itemLabel="COLORADO" itemValue="CO" />
<f:selectItem itemLabel="CONNECTICUT" itemValue="CT" />
<f:selectItem itemLabel="DELAWARE" itemValue="DE" />
<f:selectItem itemLabel="DISTRICT OF COLUMBIA" itemValue="DC" />
<f:selectItem itemLabel="FEDERATED STATES OF MICRONESIA" itemValue="FM" />
<f:selectItem itemLabel="FLORIDA" itemValue="FL" />
<f:selectItem itemLabel="GEORGIA" itemValue="GA" />
<f:selectItem itemLabel="GUAM GU" itemValue="GU" />
<f:selectItem itemLabel="HAWAII" itemValue="HI" />
<f:selectItem itemLabel="IDAHO" itemValue="ID" />
<f:selectItem itemLabel="ILLINOIS" itemValue="IL" />
<f:selectItem itemLabel="INDIANA" itemValue="IN" />
<f:selectItem itemLabel="IOWA" itemValue="IA" />
<f:selectItem itemLabel="KANSAS" itemValue="KS" />
<f:selectItem itemLabel="KENTUCKY	" itemValue="KY" />
<f:selectItem itemLabel="LOUISIANA" itemValue="LA" />
<f:selectItem itemLabel="MAINE	" itemValue="ME" />
<f:selectItem itemLabel="MARSHALL ISLANDS" itemValue="MH" />
<f:selectItem itemLabel="MARYLAND" itemValue="MD" />
<f:selectItem itemLabel="MASSACHUSETTS" itemValue="MA" />
<f:selectItem itemLabel="MICHIGAN" itemValue="MI" />
<f:selectItem itemLabel="MINNESOTA" itemValue="MN" />
<f:selectItem itemLabel="MISSISSIPPI" itemValue="MS" />
<f:selectItem itemLabel="MISSOURI" itemValue="MO" />
<f:selectItem itemLabel="MONTANA" itemValue="MT" />
<f:selectItem itemLabel="NEBRASKA" itemValue="NE" />
<f:selectItem itemLabel="NEVADA" itemValue="NV" />
<f:selectItem itemLabel="NEW HAMPSHIRE" itemValue="NH" />
<f:selectItem itemLabel="NEW JERSEY" itemValue="NJ" />
<f:selectItem itemLabel="NEW MEXICO" itemValue="NM" />
<f:selectItem itemLabel="NEW YORK" itemValue="NY" />
<f:selectItem itemLabel="NORTH CAROLINA" itemValue="NC" />
<f:selectItem itemLabel="NORTH DAKOTA" itemValue="ND" />
<f:selectItem itemLabel="NORTHERN MARIANA ISLANDS" itemValue="MP" />
<f:selectItem itemLabel="OHIO" itemValue="OH" />
<f:selectItem itemLabel="OKLAHOMA" itemValue="OK" />
<f:selectItem itemLabel="OREGON" itemValue="OR" />
<f:selectItem itemLabel="PALAU" itemValue="PW" />
<f:selectItem itemLabel="PENNSYLVANIA" itemValue="PA" />
<f:selectItem itemLabel="PUERTO RICO" itemValue="PR" />
<f:selectItem itemLabel="RHODE ISLAND" itemValue="RI" />
<f:selectItem itemLabel="SOUTH CAROLINA" itemValue="SC" />
<f:selectItem itemLabel="SOUTH DAKOTA" itemValue="SD" />
<f:selectItem itemLabel="TENNESSEE" itemValue="TN" />
<f:selectItem itemLabel="TEXAS" itemValue="TX" />
<f:selectItem itemLabel="UTAH" itemValue="UT" />
<f:selectItem itemLabel="VERMONT" itemValue="VT" />
<f:selectItem itemLabel="VIRGIN ISLANDS" itemValue="VI" />
<f:selectItem itemLabel="VIRGINIA" itemValue="VA" />
<f:selectItem itemLabel="WASHINGTON" itemValue="WA" />
<f:selectItem itemLabel="WEST VIRGINIA" itemValue="WV" />
<f:selectItem itemLabel="WISCONSIN" itemValue="WI" />
<f:selectItem itemLabel="WYOMING" itemValue="WY" />
        			</h:selectOneMenu>
        		
        			
        			<h:outputText value="Zip: "  />
        			
        			<p:inputText value="#{userBean.user.userZip}"  styleClass="tb5"/>
        		
        			<p:spacer width="30" />
        			<h:outputText value="Country: "  />
        			
        			<h:selectOneMenu  value="#{userBean.user.userCountry}"   >
        				<f:selectItem itemLabel="" itemValue="" />
        				<f:selectItem itemLabel="United States" itemValue="USA"/>
        				<f:selectItem itemLabel="Germany" itemValue="GER"/>
        				<f:selectItem itemLabel="Italy" itemValue="ITA"/>
        			</h:selectOneMenu>
        		
        			
        			<h:outputText value="Phone No: "  />
        			
        			<p:inputMask value="#{userBean.user.userPhone}"  mask="(999) 999-9999" />
        			<p:spacer width="30" />
				
        		</h:panelGrid>
        		
        		<br/>
        		
        			
        			<p:commandButton value="Reset" update="panel" action="#{userBean.reset}" />
        			
        			<p:commandButton value="Find" action="#{userBean.findUser}" update="users, panel" />
        			
        			<p:commandButton value="Update" action="#{userBean.updateUser}" update="users, panel"/>
        			
        			<p:commandButton value="Cancel" action="#{userBean.reset}" onclick="location.href='userhome.jsf'"/>
        			
        	<br /> <br />	
        	<p:dataTable id="users" var="user" value="#{userBean.userList}" style="width : 780px">
			
			<f:facet name="header">Results</f:facet>
			<p:column headerText="Id" sortBy="#{user.pharmaUserId}">#{user.pharmaUserId}</p:column>
			<p:column headerText="First Name" sortBy="#{user.firstName}">#{user.firstName}</p:column>
			<p:column headerText="Last Name" sortBy="#{user.lastName}">#{user.lastName}</p:column>
			<p:column headerText="User Status" sortBy="#{user.userStatus}">#{user.userStatus}</p:column>
			<p:column headerText="User Type" sortBy="#{user.userType}">#{user.userType}</p:column>
			<p:column headerText="Job ID" sortBy="#{user.jobId}">#{user.jobId}</p:column>
			<p:column headerText="Provider ID" sortBy="#{user.providerId}">#{user.providerId}</p:column>
    		</p:dataTable>
    		
    		</p:panel>
		</div>

		</h:form>

    </ui:define>
</ui:composition>
